using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Dimok.Aspx.Manager.Lib;
using Dimok.Exceptions;
using Data;

namespace Dimok.Aspx.Manager.Common
{
	/// <summary>
	/// Summary description for Credit.
	/// </summary>
	public partial class Credit : Page_AL
	{

		protected override void OnInit(EventArgs e) {
			base.OnInit(e);
			TradeReferences.LoanID = LoanID;
		}
		protected void Page_Load(object sender, System.EventArgs e){
			try{
				string[] reports = uox.CreditReports;
				DataSet ds = SQL.ExecuteDatasetEx(db,"SELECT Pulled FROM t_CreditInfo WHERE Borrower"+uox.BorrowerFilter());
				DataTable dt = ds.Tables[0];
				preContent.InnerHtml = reports[0];
				try{
					if( !(bool)dt.Rows[0]["Pulled"] )preContent.Style.Add("Color","RoyalBlue");
				}catch(Exception){}
				try{
					preContentCo.InnerHtml = reports[1];
					if( !(bool)dt.Rows[1]["Pulled"] )preContentCo.Style.Add("Color","orangered");
				}catch(Exception){}
				grdAccounts.DataSource = SQL.ExecuteDatasetEx(db,"SELECT * FROM vx_TradeReferences WHERE Borrower"+uox.BorrowerFilter());
				grdAccounts.DataBind();
			}catch(Exception exc){throw new ClientException(exc);}
		}

	}
}
